<?php 
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Main</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="Content/bootstrap.css" rel="stylesheet" />
<link href="Content/bootstrap-datepicker3.css" rel="stylesheet" />
<link href="Content/site.css" rel="stylesheet" />
<link href="Content/index.css" rel="stylesheet" />
<script src="Scripts/jquery-1.9.1.js"></script>
<script src="Scripts/bootstrap.js"></script>
<script src="Scripts/bootstrap-datepicker.js"></script>
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script>
      function initialize() {
        var map_canvas = document.getElementById('map_canvas');
        var map_options = {
          center: new google.maps.LatLng(-37.853394, 145.183151),
          zoom: 14,
          mapTypeId: google.maps.MapTypeId.ROADMAP
		 
        };
		var map = new google.maps.Map(map_canvas, map_options );
		var latlngPos = new google.maps.LatLng(-37.853394, 145.183151);
		var marker = new google.maps.Marker({
		  position: latlngPos,
		  map: map
		});
		
		
       
      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
</head>
<body class="bg_image">
<div class="container blue_border">
<?php include_once("php/banner.php");
include_once("php/nav_bar.php"); ?>
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-7 middle bg_white">
      <h2 align="center">Welcome to Rapid Fire League (RFL)</h2>
       <?php include_once("php/timetable_classes.php");?>
       <ul class="pagination">
       <?php 
	   		 if ($_GET['id']!=""){ $roundId =$_GET['id'];}
			 else{ $roundId = $repRound->getNextRoundByDate($today);	}
	   		 $season=$repSeason->map($repSeason->getSeasonByDate($today));
			 $rounds=$repRound->maps($repRound->getAllRoundsASC($season->seasonID));
			
			foreach ($rounds as $r){
			?>
            
            <li <?php if($roundId==$r->roundID){ echo 'class="active"';}?>><a href="timetable.php?id=<?php echo $r->roundID;?>"><?php echo " ".$r->round_number." ";?>
            </a></li>
            <?php } ?>
            </ul>
            <?php include("php/index_variables.php");?>
            <h3 align="center">Round <?php echo $round->round_number." (".$round->round_date.") <br /> Table Roster" ?> </h3>      
            <table class="table table-bordered">
            <form name="timetable" action="php/table.php" method="post">
            	<input type="hidden"  id="roundID" name="roundID" value="<?php echo $round->roundID;?>" >
				<?php $divisions=$repDivision->maps($repDivision->allDivision());
				foreach ($divisions as $div){ $divID=$div->divisionID;?>
                <?php $row=$repDivision->readDivision($divID);
				$d=$repDivision->map($row);?>
                <tr><td colspan="4" class="align-middle"><?php echo $d->division_name;?></td></tr> 
                <?php 
					foreach ($schedles as $s){
					include("php/main_teams_open.php");	
					if ($team1->divisionID==$divID){?>
                    <tr><td><?php echo $team1->team_name;?></td><td>&nbsp;vs.&nbsp;</td><td><?php echo $team2->team_name;?></td>
                    <?php if ($_SESSION['teamID']!=1){?>
                    <td><?php echo "Table ".$s->Table;?></td>
                    <?php } else { ?>
                    <td>
                    	
                        <select name="table<?php echo $s->round_scheduleID;?>">
                            <option value="<?php echo $s->Table;?>"> <?php echo "Table ".$s->Table;?></option>
                            <option value="1">Table 1</option>
                            <option value="2">Table 2</option>
                            <option value="3">Table 3</option>
                            <option value="4">Table 4</option>
                            <option value="5">Table 5</option>
                            <option value="6">Table 6</option>
                            <option value="7">Table 7</option>
                            <option value="8">Table 8</option>
                            <option value="9">Table 9</option>
                       		<option value="10">Table 10</option>
                        </select>
                    </td>
                          
                    <?php } ?>
                    </tr>
          		<?php	}	} }	?>
               <tr>
                    <td colspan="2" class="align-center"><button class="btn btn-default btn-lg" type="button" name="pdf">Save to PDF</button></td>
                    <td colspan="2" class="align-center"><button class="btn btn-default btn-lg" type="submit" name="submit">Assign Table</button></td> 
               </tr>
               </form>
          </table>
      	

      </div>
       <div class="col-md-offset-1 col-md-4">
        <div class="row">
          <div class="col-md-12 bg_white side"> 
             <h5 align="center"> SPORTLINK <br /> (2 Hanover Rd, Vermont South, Melbourne)</h5>
             <div id="map_canvas" ></div>
            
          </div>
        </div>
       
      </div>
      <?php	ob_flush();?>
    </div>
  </div>
  <?php 
include_once("php/footer.php");
?>
</div>
</body>
</html>
